<?PHP
  function __autoload($class_name){
      $namespaces = split("_",strtolower($class_name));
	  if(sizeOf($namespaces) == 3){
	    if($namespaces[0] == "plugin"){
		  require_once "system/plugins/".$namespaces[1]."/classes/".$namespaces[2].".php";
		  $imported = true;
		}
		else if($namespaces[0] == "skin"){
		  require_once "system/skins/".$namespaces[1]."/classes/".$namespaces[2].".php";
		  $imported = true;
		}
	  }
	  if(!$imported){
	    require_once "system/classes/".strtolower($class_name).".php";
	  }
  }
  session_start();
  include("system/settings.php");
  include("system/filterfilename.php");
  include("system/sys.php");
  $db = new MySQL('system/dbsettings.php');
  $db->Connect();
  $language = new Language();
  if(!isset($_SESSION['user'])) $_SESSION['user'] = new User();
  $currentpage = new Page();
  $currentpage->loadProperties($GLOBALS['db']->EscapeString($_GET['include']));
  if(!$_SESSION['user']->role->canAccess($currentpage)){
    $currentpage = new Page();
    $currentpage->loadPropertiesById(getSetting("global","global","accessdenied"));
  }
  if(!$_GET['skin']){
    include(SkinController::getCurrentSkinPath()."/index.php");
  }
  else{
    include('system/skins/'.$_GET['skin']."/index.php");
  }
?>